import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/material.dart';

class EditViewState implements Cloneable<EditViewState> {
  TextInputType inputType;
  String defaultValue = '';
  String title = '请填写';
  String desc;
  TextEditingController controller = TextEditingController();
  FocusNode commentFocus = FocusNode();
  bool isDel = false;
  int maxLines = 1;

  @override
  EditViewState clone() {
    return EditViewState()
      ..inputType = inputType
      ..defaultValue = defaultValue
      ..isDel = isDel
      ..maxLines = maxLines
      ..desc = desc
      ..title = title
      ..controller = controller
      ..commentFocus = commentFocus;
  }
}

EditViewState initState(Map<String, dynamic> args) {
  return EditViewState()
    ..inputType = args['inputType']
    ..title = args['title'] ?? '请填写'
    ..isDel = args['isDel'] ?? false
    ..maxLines = args['maxLines'] ?? 1
    ..defaultValue = args['defaultValue'] ?? ''
    ..desc = args['desc'];
}
